package ClassAndObject.Class_As_Membervariable;

//游戏当中的英雄角色类
public class Hero {
    // String是一个类
    private String name;// 英雄名字
    private int age;//英雄的年龄
    private Weapon weapon;//英雄的武器

    public Hero() {
    }

    public Hero(String name, int age, Weapon weapon) {
        this.name = name;
        this.age = age;
        this.weapon = weapon;
    }

    public void compulete(){
        //weapon是一个对象，在获取时要get
        System.out.println(name+"在"+age+"岁的时候通过"+weapon.getCode()+"实现了梦想");
    }
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Weapon getWeapon() {
        return weapon;
    }

    public void setWeapon(Weapon weapon) {
        this.weapon = weapon;
    }
}
